package BookManage;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class updateBook {
    public static void main(String[] args) {
        Connection connection=null;
        PreparedStatement statement=null;
        try {
            connection=operation.My_Get_Connection();
            String sql="update book set price=? where name=?";
            statement=connection.prepareStatement(sql);
            statement.setBigDecimal(1,new BigDecimal("61.20"));
            statement.setString(2,"深入理解Java虚拟机");
            System.out.println(statement);
            int ret=statement.executeUpdate();
            System.out.println(ret);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            operation.My_close(connection,statement,null);
        }
    }
}
